package com.app.titlebar;

import android.os.Bundle;
import android.widget.Toast;

import androidx.appcompat.app.AppCompatActivity;

import com.zndroid.widget.title.OnTitleBarListener;
import com.zndroid.widget.title.TitleBar;

/**
 *    author : Android 轮子哥
 *    github : https://github.com/getActivity/TitleBar
 *    time   : 2018/08/17
 *    desc   : TitleBar 使用案例
 */
public final class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        TitleBar titleBar = findViewById(R.id.tb_main_bar);
        titleBar.setOnTitleBarListener(new OnTitleBarListener() {

            @Override
            public void onLeftClick(TitleBar titleBar) {
                Toast.makeText(MainActivity.this, "左项 View 被点击", Toast.LENGTH_SHORT).show();
            }

            @Override
            public void onTitleClick(TitleBar titleBar) {
                Toast.makeText(MainActivity.this, "中间 View 被点击", Toast.LENGTH_SHORT).show();
            }

            @Override
            public void onRightClick(TitleBar titleBar) {
                Toast.makeText(MainActivity.this, "右项 View 被点击", Toast.LENGTH_SHORT).show();
            }
        });
    }
}